package work.mediway.mdm.biz.dto.biz;

import java.util.HashMap;
import java.util.List;

import javax.validation.constraints.Pattern;

import cn.hutool.core.map.MapUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2020/12/17
 */
@Data
@ApiModel
public class DictEditLogDTO {

    @ApiModelProperty(value = "表名称")
    private String tableCode;

    @ApiModelProperty(value = "表内rowId")
    private String tableRowId;

    @ApiModelProperty(value = "最后更新人")
    private String lastUpdateUserId;

    @ApiModelProperty(value = "操作类型(多个之间以|分隔)", allowableValues = "A,U,D", allowEmptyValue = true)
    private String editTypeCode;

    @ApiModelProperty(value = "操作类型(多个之间以|分隔)", hidden = true)
    private List<String> editTypeCodeList;

    @ApiModelProperty(value = "开始日期")
    @Pattern(regexp = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", message = "日期格式不正确,正确为yyyy-MM-dd")
    private String startDate;

    @ApiModelProperty(value = "结束时间")
    @Pattern(regexp = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", message = "日期格式不正确,正确为yyyy-MM-dd")
    private String endDate;


    @ApiModelProperty(value = "日志类型", allowableValues = "字典,患者", hidden = true)
    private String type;

    @ApiModelProperty(value = "日志类型", hidden = true)
    public static final HashMap<String, String> TYPE_CODE;

    static {
        TYPE_CODE = MapUtil.newHashMap();
        TYPE_CODE.put("字典", "CT_");
        TYPE_CODE.put("患者", "PA_");
    }
}
